import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../components/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    // 父盒子
    path: '/',
    component: Index,
    redirect: '/home',
    // 一级路由
    children: [{
      path: '/home',
      component: () => import('../components/home.vue')
    },
    {
      path: '/course',
      component: () => import('../components/course.vue'),
      // 二级路由
      redirect: '/jscourse',
      children: [
        {
          path: '/jscourse',
          component: () => import('../components/jscourse.vue')
        },
        {
          path: '/phpcourse',
          component: () => import('../components/phpcourse.vue')
        }]
    },]
  }

]

const router = new VueRouter({
  routes
})

export default router
